package homework.homework_5.computer;

/**
 * @Author admin
 * @Date 2019/3/22 10:53
 */
public class Computer {
    public USB[] usbs;
    public Computer(){
        usbs=new USB[3];
    }
    public void add(USB usb){
        for (int i = 0; i <usbs.length ; i++) {
            if(usbs!=null){
                usbs[i]=usb;
            }
        }
    }
    public void powerOn(){
        for (int i = 0; i <usbs.length ; i++) {
            if (usbs[i]!=null){
                usbs[i].turnOn();
            }
        }
        System.out.println("计算机开机成功！");
    }
    public void powerOff(){
        for (int i = 0; i <usbs.length ; i++) {
            if(usbs[i]!=null){
                usbs[i].tuenOff();
            }
        }
        System.out.println("计算机关机成功！");
    }
}
